<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
	<%@ include file="/WEB-INF/wechat/iot/common/resource_lib.jsp"%>
	<title><%=projectName %></title>
	<style type="text/css">
		body, html {
		    height: 100%;
		    -webkit-tap-highlight-color: transparent;
		}
		p.weui-tabbar__label{
			color:#999 !important ;
		}
		.weui-tabbar__icon {
		    width: 24px;
		    height: 24px;
		}
		.weui-tabbar__icon.active img.active{
			display: block;
		}
		.weui-tabbar__icon.active img{
			display: none;
		}
		.weui-tabbar__icon img{
			display: block;
		}
		.weui-tabbar__icon img.active{
			display: none;
		}
		.content-style{
			background-color: white;
			margin: 6px;
			border-radius: 5px;
			padding: 7px;
		}
		.scene-title{
			font-weight: 700;
			color: #333;
			font-size: 16px;;
		}
		.scene-type{
			display: inline-block;
			width: 10px;
			height: 10px;
		}
	</style>
</head>
<body>
	<div class="weui-tab">
		<div class="body-container" style="height: 100%;overflow: auto;">
			<div class="container">
			</div>
			<%@ include file="/WEB-INF/wechat/iot/common/pager.jsp"%>
			<div style="height: 50px;width: 100%;"></div>
		</div>
		<%@ include file="/WEB-INF/wechat/iot/moudle/operate.jsp"%>
	</div>
	
	<div class="hide" id="template">
		<div class="content-style p-10 m-10 pointer" >
			<div style="overflow: hidden;">
				<div style="float: left;line-height: 35px;">{0}</div>
				<div style="float: right;line-height: 35px;width: 15%;" onclick="forwardVisual('{1}')" >
					<a href="javascript:;" style="color: #3499da;margin-right: 10px;width: 20%;">运行</a>
				</div>
			</div>
			
		</div>
	</div>
	
</body>
<script type="text/javascript">
	$(".weui-tabbar .weui-tabbar__icon").eq(0).addClass("active");
	$(function(){

		function getData(n){
			postAjax(localUrl+"/page/visual/display?pageSize=10&paged="+n, data,function(data){
				if(isOK(data)){
					var dataT = data.data.data ;
					for(var i=0;i<dataT.length;i++){
						$(".container").append( $("#template").html().format(dataT[i].name, dataT[i].keycode ) );					
					}
					if(data.data.totalPage > data.data.paged){
						loading = false;						
					}else{
						loading =true ;	
					}
				}else{
					loading =true ;	
				}
				// 传data就可以，分页的
				pagerinit(data,".container");
			});	
		}
		
		// 查询条件
		var data = {
			scene_id: GetQueryString("id") ,
			dis_type: 1
		} ;
		var paged = 1;
		getData(paged++);
		var loading = false;  //状态标记
		$(".body-container").infinite().on("infinite", function() {
			if (loading)
				return;
			loading = true;
			setTimeout(function() {
				// 获取商品信息
				getData(paged++);
			}, 500); 
		});
	})
	
	function forwardVisual(code){
		window.location.href = "<%=basePath%>" + "/page/visual/show.html?keyCode=" + code ;
	}
	
</script>
</html>